//
//  NSTimer+Utility.m
//  CraneMachine
//
//  Created by ice on 2017/11/7.
//  Copyright © 2017年 ICE. All rights reserved.
//

#import "NSTimer+Utility.h"

@implementation NSTimer (Utility)

+ (NSTimer *)cm_scheduledTimerWithTimeInterVal:(NSTimeInterval)intervale
                                         block:(void(^)(void))block
                                       repeats:(BOOL)repeats {
    
    return [self scheduledTimerWithTimeInterval:intervale
                                         target:self
                                       selector:@selector(cm_blockInvoke:)
                                       userInfo:[block copy]
                                        repeats:repeats];
}

+ (void)cm_blockInvoke:(NSTimer *)timer {
    
    void (^block)(void) = timer.userInfo;
    if (block) {
        block();
    }
}

@end
